﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BestLifePOS_Core.Data.Commands;
using BestLifePOS_Core.DomainObjects;
using BestLifePOS_Core.Data.Fascade;
using System.Linq;

namespace BestLifePOS_PresentationLayer
{
    public partial class frmNewPR : Form
    {
        string GVtext = "text";
        public frmNewPR()
        {
            InitializeComponent();
        }

        private void btnNew_Click(object sender, EventArgs e)
        {
            txtPRId.Text = Purchase_RequestDAO.GetNewPRId().ToString();
        }

        private void frmNewPR_Load(object sender, EventArgs e)
        {
            FillBranchDropDown();
        }

        private void FillBranchDropDown()
        {
            //Fill the DataGrid
            List<Branch> LvList = BranchDAO.GetAllCompanyBranches();
            DataTable LvTable = new DataTable();
            //dgvGRN.DataSource = LvTable3;

            //cmbCategory.DataSource = LvTable;
            LvTable.Columns.Add("BranchID");
            LvTable.Columns.Add("BranchName");

            string lvtest = "";

            foreach (Branch LvBranch in LvList)
            {
                //LvTable = (DataTable)cmbCategory.DataSource;

                LvTable.Rows.Add(LvTable.NewRow());

                lvtest = LvBranch.Branch_Id.ToString() + '-' + LvBranch.Branch_Name.ToString();
                LvTable.Rows[LvTable.Rows.Count - 1][0] = lvtest;
                //LvTable.Rows[LvTable.Rows.Count - 1][0] = LvCategory.Cat_ID.ToString() +'-' + LvCategory.Cat_Name.ToString();
                //LvTable.Rows[LvTable.Rows.Count - 1][1] = LvSubCategory.Subcat_ID.ToString();


            }

            cmbBranchId.DisplayMember = "BranchID";
            cmbBranchId.ValueMember = "BranchID";
            cmbBranchId.DataSource = LvTable;


            //cmbCategory.DataBindings();



        }
    }
}
